package com.tjp.eight.ui.fragment.mydynamic;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tjp.eight.R;
import com.tjp.eight.ui.fragment.BaseFragment;
import com.tjp.eight.views.FindItemDecoration;
import com.tjp.eight.views.rcview.HeaderViewRecyclerAdapter;

/**
 * Created by Administrator on 2017/2/28.
 */
public class FragmentDynamicType extends BaseFragment<DynamicTypePresenter> {
    private RecyclerView rv_dynamic_type;
    private HeaderViewRecyclerAdapter headerViewRecyclerAdapter;
    private DynamicTypeAdapter dynamicTypeAdapter;

    @Override
    protected DynamicTypePresenter createPresenter() {
        return null;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        contentView = super.onCreateView(inflater, container, savedInstanceState);
        if (contentView == null) {
            contentView = inflater.inflate(R.layout.fragment_my_dynamic_type, container, false);
        }
        initViews();
        return contentView;
    }

    void initViews() {
        rv_dynamic_type = (RecyclerView) contentView.findViewById(R.id.rv_dynamic_type);
        rv_dynamic_type.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));

        dynamicTypeAdapter = new DynamicTypeAdapter(getActivity());
        headerViewRecyclerAdapter = new HeaderViewRecyclerAdapter(dynamicTypeAdapter);
        rv_dynamic_type.setAdapter(headerViewRecyclerAdapter);
        rv_dynamic_type.addItemDecoration(new FindItemDecoration());
    }
}
